package cn.mulanbay.persistent.entity;

import cn.mulanbay.persistent.enums.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author fenghong
 * @create 2022-01-16 10:00
 */
@TableName("system_function")
public class SystemFunction implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private String name;

    private String shortName;

    private String supportMethods;

    private String urlAddress;

    private UrlType urlType;

    private FunctionType functionType;

    private FunctionDataType functionDataType;

    private Long pid;

    private String imageName;

    private CommonStatus status;

    private Short orderIndex;

    private String beanName;

    private String idField;

    private IdFieldType idFieldType;

    private Boolean doLog;

    private Boolean triggerStat;

    private Boolean diffUser;

    private Boolean loginAuth;

    private Boolean permissionAuth;

    private Boolean ipAuth;

    private Boolean alwaysShow;

    private Boolean requestLimit;

    private Integer requestLimitPeriod;

    private Integer dayLimit;

    private Boolean recordReturnData;

    private Integer rewardPoint;

    private Integer errorCode;

    private Boolean treeStat;

    private Boolean secAuth;

    private String perms;

    private String component;

    /**
     * mysql关键字处理
     */
    @TableField("`path`")
    private String path;

    private Boolean visible;

    private Boolean router;

    private Boolean frame;

    private Boolean cache;

    private String remark;

    private LocalDateTime createdTime;

    private LocalDateTime lastModifyTime;

    @TableField(exist = false)
    List<SystemFunction> children = new ArrayList<>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }
    public String getSupportMethods() {
        return supportMethods;
    }

    public void setSupportMethods(String supportMethods) {
        this.supportMethods = supportMethods;
    }
    public String getUrlAddress() {
        return urlAddress;
    }

    public void setUrlAddress(String urlAddress) {
        this.urlAddress = urlAddress;
    }
    public UrlType getUrlType() {
        return urlType;
    }

    public void setUrlType(UrlType urlType) {
        this.urlType = urlType;
    }
    public FunctionType getFunctionType() {
        return functionType;
    }

    public void setFunctionType(FunctionType functionType) {
        this.functionType = functionType;
    }
    public FunctionDataType getFunctionDataType() {
        return functionDataType;
    }

    public void setFunctionDataType(FunctionDataType functionDataType) {
        this.functionDataType = functionDataType;
    }
    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }
    public String getImageName() {
        return imageName;
    }

    public void setImageName(String imageName) {
        this.imageName = imageName;
    }
    public CommonStatus getStatus() {
        return status;
    }

    public void setStatus(CommonStatus status) {
        this.status = status;
    }
    public Short getOrderIndex() {
        return orderIndex;
    }

    public void setOrderIndex(Short orderIndex) {
        this.orderIndex = orderIndex;
    }
    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }
    public String getIdField() {
        return idField;
    }

    public void setIdField(String idField) {
        this.idField = idField;
    }
    public IdFieldType getIdFieldType() {
        return idFieldType;
    }

    public void setIdFieldType(IdFieldType idFieldType) {
        this.idFieldType = idFieldType;
    }
    public Boolean getDoLog() {
        return doLog;
    }

    public void setDoLog(Boolean doLog) {
        this.doLog = doLog;
    }
    public Boolean getTriggerStat() {
        return triggerStat;
    }

    public void setTriggerStat(Boolean triggerStat) {
        this.triggerStat = triggerStat;
    }
    public Boolean getDiffUser() {
        return diffUser;
    }

    public void setDiffUser(Boolean diffUser) {
        this.diffUser = diffUser;
    }
    public Boolean getLoginAuth() {
        return loginAuth;
    }

    public void setLoginAuth(Boolean loginAuth) {
        this.loginAuth = loginAuth;
    }
    public Boolean getPermissionAuth() {
        return permissionAuth;
    }

    public void setPermissionAuth(Boolean permissionAuth) {
        this.permissionAuth = permissionAuth;
    }
    public Boolean getIpAuth() {
        return ipAuth;
    }

    public void setIpAuth(Boolean ipAuth) {
        this.ipAuth = ipAuth;
    }
    public Boolean getAlwaysShow() {
        return alwaysShow;
    }

    public void setAlwaysShow(Boolean alwaysShow) {
        this.alwaysShow = alwaysShow;
    }
    public Boolean getRequestLimit() {
        return requestLimit;
    }

    public void setRequestLimit(Boolean requestLimit) {
        this.requestLimit = requestLimit;
    }
    public Integer getRequestLimitPeriod() {
        return requestLimitPeriod;
    }

    public void setRequestLimitPeriod(Integer requestLimitPeriod) {
        this.requestLimitPeriod = requestLimitPeriod;
    }
    public Integer getDayLimit() {
        return dayLimit;
    }

    public void setDayLimit(Integer dayLimit) {
        this.dayLimit = dayLimit;
    }
    public Boolean getRecordReturnData() {
        return recordReturnData;
    }

    public void setRecordReturnData(Boolean recordReturnData) {
        this.recordReturnData = recordReturnData;
    }
    public Integer getRewardPoint() {
        return rewardPoint;
    }

    public void setRewardPoint(Integer rewardPoint) {
        this.rewardPoint = rewardPoint;
    }
    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }
    public Boolean getTreeStat() {
        return treeStat;
    }

    public void setTreeStat(Boolean treeStat) {
        this.treeStat = treeStat;
    }
    public Boolean getSecAuth() {
        return secAuth;
    }

    public void setSecAuth(Boolean secAuth) {
        this.secAuth = secAuth;
    }
    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }
    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }
    public Boolean getVisible() {
        return visible;
    }

    public void setVisible(Boolean visible) {
        this.visible = visible;
    }
    public Boolean getRouter() {
        return router;
    }

    public void setRouter(Boolean router) {
        this.router = router;
    }
    public Boolean getFrame() {
        return frame;
    }

    public void setFrame(Boolean frame) {
        this.frame = frame;
    }
    public Boolean getCache() {
        return cache;
    }

    public void setCache(Boolean cache) {
        this.cache = cache;
    }
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }
    public LocalDateTime getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(LocalDateTime lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public List<SystemFunction> getChildren() {
        return children;
    }

    public void setChildren(List<SystemFunction> children) {
        this.children = children;
    }

    /**
     * 是否包含子列表（页面使用）
     * @return
     */
    public Boolean getHasChildren() {
        if (functionDataType == FunctionDataType.M || functionDataType == FunctionDataType.C) {
            return true;
        } else {
            return false;
        }
    }


    @Override
    public String toString() {
        return "SystemFunction{" +
            "id=" + id +
            ", name=" + name +
            ", shortName=" + shortName +
            ", supportMethods=" + supportMethods +
            ", urlAddress=" + urlAddress +
            ", urlType=" + urlType +
            ", functionType=" + functionType +
            ", functionDataType=" + functionDataType +
            ", pid=" + pid +
            ", imageName=" + imageName +
            ", status=" + status +
            ", orderIndex=" + orderIndex +
            ", beanName=" + beanName +
            ", idField=" + idField +
            ", idFieldType=" + idFieldType +
            ", doLog=" + doLog +
            ", triggerStat=" + triggerStat +
            ", diffUser=" + diffUser +
            ", loginAuth=" + loginAuth +
            ", permissionAuth=" + permissionAuth +
            ", ipAuth=" + ipAuth +
            ", alwaysShow=" + alwaysShow +
            ", requestLimit=" + requestLimit +
            ", requestLimitPeriod=" + requestLimitPeriod +
            ", dayLimit=" + dayLimit +
            ", recordReturnData=" + recordReturnData +
            ", rewardPoint=" + rewardPoint +
            ", errorCode=" + errorCode +
            ", treeStat=" + treeStat +
            ", secAuth=" + secAuth +
            ", perms=" + perms +
            ", component=" + component +
            ", path=" + path +
            ", visible=" + visible +
            ", router=" + router +
            ", frame=" + frame +
            ", cache=" + cache +
            ", remark=" + remark +
            ", createdTime=" + createdTime +
            ", lastModifyTime=" + lastModifyTime +
        "}";
    }
}
